import React from 'react'
import Block from 'fs-flex'
import Header from '../../components/Header/index'
import {WingBlank,List} from 'antd-mobile'
import CmsService from '../../services/CmsService'
import Constant from '../../utils/constant'
const Item = List.Item;


class Notice extends React.Component{
    state={
        data:[]
    }
    async componentDidMount(){
        this.query()
    }
    query=async()=>{
        const {code,data}=await CmsService.list()
        if (Constant.responseOK === code) {
            this.setState({ data: data })
        }
    }
    gotoDetail(id){
        this.props.history.push(`/manage/cms/detail?id=${id}`)
    }
    render(){
        const {data}=this.state
        console.log(data)
        return(
            <Block vf>
                <Block>
                    <Header title='办理须知' />
                </Block>
                <Block f='1' vf>
                    <Block a='c'></Block>
                    <List>
                    {
                        data&&data.length>0?data.map((item,index)=><Item key={index} onClick={this.gotoDetail.bind(this,item.id)}>{item.articleTitle}</Item>):<Block a='c' j='c'>暂无...</Block>
                    }
                    </List>
                </Block>
            </Block>
        )
    }
}

export default Notice;